/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package FarmacieDAL;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Administrator
 */
@Entity
@Table(name = "PRODUCATORI")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Producatori.findAll", query = "SELECT p FROM Producatori p"),
    @NamedQuery(name = "Producatori.findByIdProducator", query = "SELECT p FROM Producatori p WHERE p.idProducator = :idProducator"),
    @NamedQuery(name = "Producatori.findByProducator", query = "SELECT p FROM Producatori p WHERE p.producator = :producator")})
public class Producatori implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_PRODUCATOR")
    private Integer idProducator;
    @Column(name = "PRODUCATOR")
    private String producator;
    @OneToMany(mappedBy = "idProducator")
    private Collection<Medicament> medicamentCollection;

    public Producatori() {
    }

    public Producatori(Integer idProducator) {
        this.idProducator = idProducator;
    }

    public Integer getIdProducator() {
        return idProducator;
    }

    public void setIdProducator(Integer idProducator) {
        this.idProducator = idProducator;
    }

    public String getProducator() {
        return producator;
    }

    public void setProducator(String producator) {
        this.producator = producator;
    }

    @XmlTransient
    public Collection<Medicament> getMedicamentCollection() {
        return medicamentCollection;
    }

    public void setMedicamentCollection(Collection<Medicament> medicamentCollection) {
        this.medicamentCollection = medicamentCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idProducator != null ? idProducator.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Producatori)) {
            return false;
        }
        Producatori other = (Producatori) object;
        if ((this.idProducator == null && other.idProducator != null) || (this.idProducator != null && !this.idProducator.equals(other.idProducator))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "FarmacieDAL.Producatori[ idProducator=" + idProducator + " ]";
    }
    
}
